<script setup>
import { ref, watch } from 'vue';

const props = defineProps({
  value: [Number, Array],
  change: {
    type: Function,
    default: () => {}
  }
})

const val = ref(props.value)
watch(() => props.value, newVal => {
  val.value = newVal
})

const emit = defineEmits(['input'])
emit('input', val) // 传递给父组件
</script>

<template>
  <div class="rate-container">
    <el-rate 
      v-model="val"
      v-bind="$attrs"
      @change="change"></el-rate>
  </div>
</template>

<style scoped>
.rate-container{
  height: 100%;
  
}
</style>
